# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - patch for AArch64

pkgname=imake
pkgver=1.0.7
pkgrel=1
pkgdesc="X.Org imake program and related utilities"
arch=('i686' 'x86_64')
url="http://xorg.freedesktop.org/"
license=('custom')
depends=('glibc')
makedepends=('pkgconfig' 'xproto' 'perl' 'xorg-util-macros' 'xorg-font-util')
optdepends=('perl: for mkhtmlindex')
source=(http://xorg.freedesktop.org/releases/individual/util/imake-${pkgver}.tar.bz2
        http://xorg.freedesktop.org/releases/individual/util/gccmakedep-1.0.3.tar.bz2
        http://xorg.freedesktop.org/releases/individual/util/lndir-1.0.3.tar.bz2
        http://xorg.freedesktop.org/releases/individual/util/makedepend-1.0.5.tar.bz2
        http://xorg.freedesktop.org/releases/individual/util/xorg-cf-files-1.0.5.tar.bz2
        linuxconfig.patch
        aarch64.patch
        LICENSE)
sha1sums=('52e236776133f217d438622034b8603d201a6ec5'
          '03018e2fb9d7df4fec1623cedb1c090bc224f971'
          'fc71a6ff2cc0a1065cfb608796ffd6b4f0ce76fe'
          '2599afa039d2070bae9df6ce43da288b3a4adf97'
          'ae22eb81d56d018f0b3b149f70965ebfef2385fd'
          '72f2d4cc4d4cc5f85ba6982718ae1bbb7e56e0d0'
          '970cd4750ac0d73acb638205e58977a03ef8dc22'
          'c5ecffb25ad079ba3858e3aec047d046df603a89')


prepare() {
  cd xorg-cf-files-1.0.5
  patch -p1 -i ../linuxconfig.patch
  patch -p2 -i ../aarch64.patch
}

build() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      autoreconf -fi
      ./configure --prefix=/usr --mandir=/usr/share/man
      make
      popd
    fi
  done
}

package() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      make DESTDIR="${pkgdir}" install
      popd
    fi
  done
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
